//
//  EveryStoryCollectionViewCell.m
//  littleLight's Project-A
//
//  Created by dllo on 16/5/16.
//  Copyright © 2016年 light. All rights reserved.
//

#import "EveryStoryCollectionViewCell.h"
#import <UIImageView+WebCache.h>
@implementation EveryStoryCollectionViewCell


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createView];
        
    }
    return self;
    
}

- (void)createView
{
    self.index_cover = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.contentView.frame.size.width, self.contentView.frame.size.height / 7 * 4)];
    self.index_cover.layer.masksToBounds = YES;
    self.index_cover.layer.cornerRadius = 5;
    [self.contentView addSubview:self.index_cover];
    self.text = [[UILabel alloc] initWithFrame:CGRectMake(5, self.contentView.frame.size.height / 7 * 4, self.contentView.frame.size.width - 5, self.contentView.frame.size.height / 7 * 2 - 10)];
    self.text.font = [UIFont systemFontOfSize:15];
    self.text.numberOfLines = 0;
    [self.contentView addSubview:self.text];
    self.avatar_m = [[UIImageView alloc] initWithFrame:CGRectMake(5, self.contentView.frame.size.height / 7 * 6, self.contentView.frame.size.height / 7, self.contentView.frame.size.height / 7)];
    self.avatar_m.layer.masksToBounds = YES;
    self.avatar_m.layer.cornerRadius = self.contentView.frame.size.height / 7 / 2;
    [self.contentView addSubview:self.avatar_m];
    self.name = [[UILabel alloc] initWithFrame:CGRectMake(self.contentView.frame.size.height / 7 + 20, self.contentView.frame.size.height / 7 * 6, self.contentView.frame.size.width / 7 * 5, self.contentView.frame.size.height / 7)];
    self.name.textColor = [UIColor grayColor];
    self.name.font = [UIFont systemFontOfSize:13];
    
    [self.contentView addSubview:self.name];
    
    
    
    
    
    
    
    
}






- (void)setModel:(EveryDayModel *)model
{
    _model = model;
    [self.index_cover sd_setImageWithURL:[NSURL URLWithString:_model.index_cover]];
    self.text.text = _model.text;
    [self.avatar_m sd_setImageWithURL:[NSURL URLWithString:model.userModel.avatar_m]];
    self.name.text = _model.userModel.name;
    
   



}


@end
